package edu.zut.cs.network.Experiment7;
import java.util.Arrays;
import java.util.Scanner;
import org.apache.log4j.*;

public class SumIntegers {
    private static Logger logger = Logger.getLogger(SumIntegers.class);
    public static int sumIntegers(String str){
        int sum = 0;
        String[] str2 = str.split("[ ]+");
        int[] arr = new int[str2.length];
        for(int i = 0; i < arr.length;i++){
            arr[i] = Integer.parseInt(str2[i]);
            sum = sum + arr[i];
        }
        logger.info("这些整数之和为："+sum);
        return 0;
    }

    public static void main(String[] args) {
        logger.info("请输入一些整数，整数之间以空格隔开:");
        Scanner input = new Scanner(System.in);
        String str1 = input.nextLine();
        sumIntegers(str1);
    }
}
